/*
 *    This file is part of CeluMap.
 *
 *    CeluMap is free software; you can redistribute it and/or modify
 *    it under the terms of the GNU Lesser General Public License as published by
 *    the Free Software Foundation; either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    CeluMap is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public License
 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *    Copyright 2006, 2007, 2008 Gonzalo Merayo
 *    gonzalo (at) celumap.com.ar
 *    www.celumap.com.ar
 *
 */

package file;

import java.io.IOException;
import java.io.InputStream;

import javax.microedition.io.Connector;
import javax.microedition.io.HttpConnection;

import config.Properties;


public class HomeGetter implements FileGetter{

	private HomeGetter(){
		
	}
	
	static HomeGetter me = null;
	public static HomeGetter getInstance(){
		if(me==null)
			me = new HomeGetter();
		return me;
	}
	
	public InputStream getResource(String s) {
		HttpConnection c;
		InputStream i = null;
		try {
			c = (HttpConnection)Connector.open(Properties.getProperty("homeURL")+s);
			c.setRequestMethod(HttpConnection.GET);
			c.setRequestProperty("content-type", "text/xml");
			i = c.openInputStream();
			c.close();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		return i;
	}

}
